package com.aspose.cells.b.a.d;

import java.io.IOException;
import java.io.InputStream;

class zf extends InputStream {
   private boolean b;
   zm a;

   public zf(zm var1) throws Exception {
      this(var1, true);
   }

   public zf(zm var1, boolean var2) throws Exception {
      this.b = true;
      this.a = var1;
      this.a.b(0L);
      this.b = var2;
   }

   public int read() throws IOException {
      try {
         return this.a.c();
      } catch (Exception var2) {
         throw new IOException(var2.getMessage());
      }
   }

   public int read(byte[] b, int off, int len) throws IOException {
      try {
         int var4 = this.a.a(b, off, len);
         return var4 == 0 ? -1 : var4;
      } catch (Exception var5) {
         throw new IOException(var5.getMessage());
      }
   }

   public long skip(long n) throws IOException {
      try {
         long var3 = this.a.i();
         long var5 = this.a.a(n, 1);
         return var5 - var3;
      } catch (Exception var7) {
         throw new IOException(var7.getMessage());
      }
   }

   public int available() throws IOException {
      try {
         return (int)(this.a.h() - this.a.i());
      } catch (Exception var2) {
         throw new IOException(var2.getMessage());
      }
   }

   public void close() throws IOException {
      if (this.b) {
         try {
            this.a.a();
         } catch (Exception var2) {
            throw new IOException(var2.getMessage());
         }
      }
   }
}
